// 统一管理项目接口地址
import axios from "@/request/request"
import qs from "qs"

// 获取精品推荐的数据
export const jingpinAPT = () => axios.get("/products/recommend")

// 获取热门数据
export const remenAPT = () => axios.get("/products/hot")

// 发送短信验证码

export const SendSMSAPT = (params) => {
    return axios.post("/sendSMS", qs.stringify(params))
}
// 发送登录请求
export const PhoneReginAPT = (params) => {
    return axios.post("/phoneRegin", qs.stringify(params))
}

// 微信扫码请求
export const WechatUsersAPT = (params) => axios.post("/wechatUsers/PCLogin", qs.stringify(params))


// console.log("序列化:", qs.stringify({ a: 10, b: 100 }));  //a=10&b=100

// 手机绑定微信
export const BindingAPT = (params) => axios.post("/wechatUsers/binding", qs.stringify(params))


// 获取用户信息 
export const UserProfilesAPI = () => axios.get("/shop/userProfiles");

// 请求产品想详情信息

export const GoodDetailsAPI = (id) => axios.get(`/products/${id}`);

// 加入购物车

export const CartsAPT = (params) => axios.post("/shop/carts/add", qs.stringify(params))

// 全部商品
export const ProductsAPI = (params) => axios.get("/products", { params });

// 查看购物车
export const ShopAPI = () => axios.get(`/shop/carts`);

// 解绑
export const UnbindingWeChat = () => axios.put("/wechatUsers/unbindingWeChat")

// 删除商品

export const DelAPI = (id) => axios.delete(`/shop/carts?productIds=${id}`);